package com.xiaoshu.test.rpc.netty.client;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;

public class RestHandler extends ChannelInboundHandlerAdapter {

	private Object response;
	
	
    
    public Object getResponse() {
		return response;
	}

	@Override
    public void channelReadComplete(ChannelHandlerContext ctx) throws Exception {
       ctx.flush();
       ctx.close();
    }
	
    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
       response = msg;
       System.out.println("client接收到服务器返回的消息:" + msg);    
    }
    
    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
            throws Exception {
        cause.printStackTrace();
    }

}
